package jeecg.business.service.impl.alarm;

import java.util.List;

import jeecg.business.entity.alarm.AlarmWordEntity;
import jeecg.business.service.alarm.AlarmWordServiceI;

import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service("alarmWordService")
@Transactional
public class AlarmWordServiceImpl extends CommonServiceImpl implements AlarmWordServiceI {
	public void importXls(List<AlarmWordEntity> alarmList){
		if(alarmList != null){
			for(AlarmWordEntity a : alarmList){
				if(get(a.getCy()) == null)
					save(a);
			}
		}
	}
	
	public AlarmWordEntity get(String cy){
		String hql = " from AlarmWordEntity where cy = '"+cy+"'";
		List<AlarmWordEntity> list = findByQueryString(hql);
		if(list != null && list.size()>0) return list.get(0);
		return null;
	}
}